//
//  HZHomeController.swift
//  555wobo
//
//  Created by 黄某某 on 15/12/15.
//  Copyright © 2015年 黄某某. All rights reserved.
//

import UIKit

class HZHomeController: HZBaseController {

    override func viewDidLoad() {
        super.viewDidLoad()
        setupNav()
    }
    private func setupNav(){
        navigationItem.leftBarButtonItem = UIBarButtonItem(imageName: "navigationbar_friendsearch")
        navigationItem.rightBarButtonItem = UIBarButtonItem(imageName: "navigationbar_pop")
        let title = HZUserAccount.loadUserAccount()?.screen_name ?? "没获取到用户名"
        let titleButton = HZHomeTextView(imageName: "navigationbar_arrow_down", title: title)
        titleButton.addTarget(self, action: "homeTitleButtonClick:", forControlEvents: UIControlEvents.TouchUpInside)
        navigationItem.titleView = titleButton
        
    }
    func homeTitleButtonClick(button: UIButton){
        button.selected = !button.selected
        UIView.animateWithDuration(0.3) { () -> Void in
            button.imageView?.transform = button.selected ? CGAffineTransformMakeRotation(CGFloat(M_PI - 0.001)) : CGAffineTransformIdentity
        }
        
    }


}
